/**
 * Created by Panda on 16/7/20
 */
(function () {
    'use strict';

    var replaceWrap = function (html) {
        return html.replace(/\n\r/g, "<br>").replace(/\n/g, "<br>").replace(/\r/g, "<br>");
    };


    angular
        .module('com.akxx.aqzyk')
        .filter('sexFilter', sexFilter)
        .filter('htmlFilter', htmlFilter)
        .filter('wrapFilter', wrapFilter);

    /** @ngInject */
    function sexFilter() {
        return function (input) {
            return input === "1" ? "男" : "女";
        }
    }

    function htmlFilter($sce) {
        return function (input) {
            var html = "";
            if (!_.isEmpty(input)) {
                html = replaceWrap(input);
                html = replaceEmoji(html);
            }
            return $sce.trustAsHtml(html);
        }
    }

    function wrapFilter($sce) {
        return function (input) {
            var html = "";
            if (!_.isEmpty(input)) {
                html = replaceWrap(input);
            }
            return $sce.trustAsHtml(html);
        }
    }


})();
